Skip to content

Conversation

@ebtasam-faridy
Copy link

…pload

Comment on lines 431 to 436
if count <= 1 {
log.Warnf("Skipping '%s' since it is a directory. Please use correct glob expression if this is unexpected.", source)
return fmt.Errorf("directory '%s' specified without glob pattern. Use a pattern like '%s/*' or '%s/**' to upload directory contents", source, source, source)
}
return true
}
return false
return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When count > 1 (directory has glob-expanded children), the new code returns nil, and the caller will attempt to upload the directory itself. that will fail at os.Open or S3's PutObject. old code always skipped directories. we need to either:

  1. Return (skip bool, err error) so caller can continue for directories with children
  2. Or add a sentinel error like errSkipDirectory that the caller handles with continue

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returned errSkip here so caller can continue for directories with children

Copy link
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the bug, preserves original behavior, cross-platform tests, clean pattern so LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants